package com.blast.comicsisland.adapters;

/**
 * Created by kHRYSTAL on 2015/6/26.
 * Email:jessicastam_love@163.com
 */

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentStatePagerAdapter;
import com.blast.comicsisland.fragment.AdvertFragment;

import java.util.List;

/**
 * 书城推荐页上方的Viewpager适配器
 */
public class RecommendPagerAdapter extends FragmentStatePagerAdapter{
    private List<AdvertFragment> fragments;
    public RecommendPagerAdapter(FragmentManager fm,List<AdvertFragment> fragments) {
        super(fm);
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        Fragment ret = null;
        if (fragments!=null){
            ret = fragments.get(position);
        }
        return ret;
    }

    @Override
    public int getCount() {
        int ret = 0;
        if (fragments!=null){
            ret = fragments.size();
        }
        return ret;
    }
}
